<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>权重优先级计算</title>
    <style>
        /* !important最高 */
        /* 继承最低 */

        /* (0,2,0,0) */
        #father #son {
            color: blue;
        }

        /* (0,1,1,1) */
        #father p.c2 {
            color: wheat;
        }

        /* (0,0,2,2) */
        div.c1 p.c2 {
            color: brown;
        }

        /* 继承最低 */
        #father {
            color: green;
        }

        /* 继承最低 */
        div #father.c1 {
            color: yellowgreen;
        }
    </style>
</head>

<body>
    <div id="father" class="c1">
        <p id="son" class="c2">计算优先级</p>
    </div>
</body>

</html>